package cn.sanshuilin.kst.system.provider.write.dao;

import cn.sanshuilin.kst.system.provider.bean.LoginRecordBean;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author greenlee
 * @version v1.0
 * @create 创建时间: 2018-02-01 15:08
 * Copyright 2018  by 三水林科技有限公司
 **/
public interface LoginRecordDao extends JpaRepository<LoginRecordBean,Long> {

    LoginRecordBean findByToken(String token);

    @Transactional
    @Modifying
    @Query(value = "DELETE FROM login_record WHERE ACCOUNT_ID=:accountId",nativeQuery = true)
    int removeAccountId(@Param("accountId") String accountId);
}
